package com.model.xmlElement;


import java.io.File;

import javax.xml.bind.JAXBException;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.tool.JaxbReadXmlTool;

/**
 * *********************************************
 * @author Administrator
 * @FileName XMLElements.java
 * @Description XML配置文件对应的集合->单例
 **********************************************
 */
public class DataColumnsSingleton{
	public static final Logger LOG = LoggerFactory.getLogger(DataColumnsSingleton.class);
	
	private static DataColumns dataColumns;
	private DataColumnsSingleton(){}
	
	public static DataColumns getSingle(File file){
		if(dataColumns == null){
			synchronized (DataColumnsSingleton.class){
				if(dataColumns == null){
					try {
						dataColumns = JaxbReadXmlTool.readStringFromFile(DataColumns.class, file);
					} catch (JAXBException e) {
						e.printStackTrace();
					}
				}
			}
		}
		return dataColumns;
	}
}